<%@page import="transfer.Order"%>
<%@page import="content.OrderContent"%>
<%@page import="transfer.User"%>
<%@page import="controller.SessionAttribute"%>
<%@page import="java.util.ArrayList"%>
<div class="box">
    <table class="table" rules=all>
        <tr>
            <td>#</td>
            <td>Customer name</td>
            <td>Creation date</td>
            <td>Warehouse</td>
            <td>Sum</td>  
        </tr>

        <%            
            ArrayList orderList = OrderContent.getAllQueued((User) session.getAttribute(SessionAttribute.USER));            
            for (int i = 0; i < orderList.size(); i++) {                
                Order order = (Order) orderList.get(i);
        %>
        <tr>
            <td><a href="admin.jsp?content=order&operation=view&id=<%=order.getIdOrder()%>"><%=order.getIdOrder().intValue()%></a></td>            
            <%
                if (order.getCustomer() != null) {
            %>
                <td><%=order.getCustomer().getFirstName() + " " + order.getCustomer().getLastName()%></td>            
            <%
                } else {
            %>
                <td>Anonymous user</td>
            <%
                }
            %>
            <td><%=order.getCreationDate()%></td>
            <td><%=order.getWarehouse().getNameWarehouse()%></td>
            <td><%=order.getTotalCost()%></td>
        </tr>
        <% }%>
    </table>
</div>

